Skip to content

Conversation

siverne
Copy link
Member

@siverne siverne commented Nov 16, 2026

Closes #19.

The import read the whole file with readFileSync. The Full ratings file is 1 GB, which is larger as
one string than Node allows, so the import crashed before it started. It now reads the ratings line
by line and writes them in batches of 5 000, so memory use stays flat whichever version is loaded.
The wines file is still read at once (34 MB, and it has commas inside quoted fields).

Loaded the Full version locally: 100 646 wines and 21 013 536 ratings.

Step Time
Import of wines 4.8 s
Import of ratings 228.8 s
Recalculating every average 15.3 s

With 21 million ratings in the database, requests stay fast: 55 ms for the first page, 49 ms for a
search, 23 ms for filters with sorting, and 57 ms for the filter counts. The database is 2.4 GB.

The VM keeps the Slim version: Full needs more disk than it has to spare.

Also adds splitCsvLine with tests, and the numbers are documented in README and docs/vm.md.

Tested: npm run check passes, 96 backend tests pass.

@siverne siverne requested a review from a team as a code owner November 16, 2026 10:40
@oscarba oscarba merged commit 054edf0 into main Nov 16, 2026
@oscarba oscarba deleted the 19-full-dataset-load-test branch November 16, 2026 12:14
@siverne siverne mentioned this pull request Nov 16, 2026
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch dataset to X-Wines: migrations and import
2 participants